extends PanelContainer
class_name SlotUI

@onready var pressed_panel: Panel = $Pressed
@onready var disabled_panel: Panel = $Disabled
@onready var texture_button: TextureButton = $TextureButton

var skin_state:SkinState

var disabled:bool = false:
	set(value):
		disabled = value
		disabled_panel.visible = value
		texture_button.disabled = value
var equipped:bool = false:
	set(value):
		equipped = value
		pressed_panel.visible = value
		texture_button.button_pressed = value

signal button_toggled(toggled_on:bool,skin_profile)

func _ready() -> void:
	texture_button.texture_normal = skin_state.skin_profile.icon
	texture_button.tooltip_text = skin_state.skin_profile.skin_name
	disabled = !skin_state.is_owned
	equipped = skin_state.is_equipped


func _on_texture_button_toggled(toggled_on: bool) -> void:
	equipped = toggled_on
	button_toggled.emit(toggled_on,skin_state)
